const express = require("./express");
const app = express();

app.use(function (req, res, next) {
  let flag = Math.random() > 0.5;
  console.log(flag, "----------");
  if (flag) {
    return next("errorxxxxx");
  }
  next();
});
app.get("/", function (req, res, next) {
  console.log(1);
  next();
});

app.get("/", function (req, res, next) {
  console.log("/2");
  res.end("get/");
});

app.get("/a", function (req, res, next) {
  console.log("/2");
  res.end("/get");
});
app.use("/", function (err, req, res, next) {
  res.end(err);
});

app.listen(3000);
